<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>libdill</title>
  <link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>

<h1>libdill: Structured Concurrency for C</h1>

<ul id='toplist'>
<li><a href="index.html">Home</a></li>
<li><a href="download.html">Download</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorials</a></li>
<li><a href="faq.html">FAQ</a></li>
</ul>
<h1 id="name">NAME</h1>
<p>hclose - hard-closes a handle</p>
<h1 id="synopsis">SYNOPSIS</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="pp">#include </span><span class="im">&lt;libdill.h&gt;</span>

<span class="dt">int</span> hclose(
    <span class="dt">int</span> h);</code></pre></div>
<h1 id="description">DESCRIPTION</h1>
<p>This function closes a handle. Once all handles pointing to the same underlying object have been closed, the object is deallocated immediately, without blocking.</p>
<p>The function guarantees that all associated resources are deallocated. However, it does not guarantee that the handle's work will have been fully finished. E.g., outbound network data may not be flushed.</p>
<p>In the case of network protocol sockets the entire protocol stack is closed, the topmost protocol as well as all the protocols beneath it.</p>
<p><strong>h</strong>: The handle.</p>
<h1 id="return-value">RETURN VALUE</h1>
<p>In case of success the function returns 0. In case of error it returns -1 and sets <strong>errno</strong> to one of the values below.</p>
<h1 id="errors">ERRORS</h1>
<ul>
<li><strong>EBADF</strong>: Invalid handle.</li>
<li><strong>ENOTSUP</strong>: The handle does not support this operation.</li>
</ul>
<h1 id="example">EXAMPLE</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="dt">int</span> ch[<span class="dv">2</span>];
chmake(ch);
hclose(ch[<span class="dv">0</span>]);
hclose(ch[<span class="dv">1</span>]);</code></pre></div>
<h1 id="see-also">SEE ALSO</h1>
<p><strong>hmake</strong>(3) <strong>hown</strong>(3) <strong>hquery</strong>(3)</p>
</body>
